<template>
  <view class="container">
    <navbar :config="config" backColor="#999999"></navbar>
    <view class="topview" :style="{top:tabTop+'px'}">
      <!--订单类型选择-->
      <scroll-view scroll-x="true" class="scrollbox ">
        <view class="order-type u-flex-center">
          <view class="type-name u-font26 u-181818" :class="{'active': isChange == index}"
            v-for="(item,index) in orderType" :key="index" @click="clickBtn(index)">
            {{item}}
          </view>
        </view>
      </scroll-view>
    </view>
    <view class="plrbottom">
      <!--订单列表-->
      <view class="order-list" v-if="isChange==0||isChange==1">
        <view class="order-item u-font24 u-1A1A1A" v-for="(item,index) in orderList" :key="item.id">


          <view class="listtwo" v-if="item.payment_status==5">
            <view class="childBox" v-for="ordersList in item.orders" :key="ordersList.id">
              <view class="u-plr30 pt15-pb24">
                <view class="u-flex-center-sb">
                  <view class="u-text1 viewWidthTitle">
                    <text class="iconfont2 u-font34 u-bold " style="color: #057D53;">&#xe611;</text>
                    <text class="u-1A1A1A u-font30 u-ml15">{{ordersList.shop_name}}</text>
                    <text class="u-CCC right-icon iconfont">&#xe6c7;</text>
                  </view>
                  <view v-if="ordersList.end==true">
                    <text class="u-FF0000 u-font28">交易完成</text>
                  </view>
                  <view v-if="ordersList.end==false">
                    <text class="u-FF0000 u-font28" v-if="ordersList.comment_status==2">交易完成</text>
                    <text class="u-FF0000 u-font28"
                      v-if="(ordersList.comment_status==0||ordersList.comment_status==1)&&ordersList.rights_type==0">{{ordersList.transaction_status | payStatus}}</text>
                    <text class="u-FF0000 u-font28" v-if="ordersList.rights_type >0">维权中</text>
                  </view>
                </view>
              </view>
              <view class="u-border-one-one"></view>
              <view v-for="childItem in ordersList.child_order_list" :key="childItem.id"
                @click="goProductDetails(childItem.goods_id,childItem.source_shop_id)">
                <ldgoods :value="childItem" :position="list"></ldgoods>
              </view>
              <view class="u-mt20 u-text-right u-plr30">
                <view class="u-flex-center" style="justify-content: flex-end;">
                  <text>共{{ordersList.goods_number}}件商品，总金额</text>
                  <view class="u-FF0000 u-font32">
                    <rich-text :nodes="$mUtil.priceBigSmall(ordersList.total_amount)"></rich-text>
                  </view>
                </view>
                <view class="u-mt10" v-if="ordersList.should_freight*1 > 0">含运费￥{{ordersList.should_freight}}</view>
                <view class="u-flex-column-end u-mt30">
                  <view class="btn-type u-flex">
                    <!--待付款-->
                    <view v-if="ordersList.transaction_status==0&&item.close_mode==0">
                      <view class="pay-time"> <text class="iconfont time-icon">&#xe681;</text> 支付剩余
                        ({{item | dateFilter}})</view>
                      <view class="btn-item u-text-center u-FF0000 br-FF0000">去付款</view>
                    </view>
                    <!--等待使用-->
                    <view class="u-flex-center" style="justify-content: flex-end;"
                      v-if="ordersList.transaction_status==1&&ordersList.rights_type==0">
                      <view class="btn-item u-text-center u-999 br-999" v-if="!ordersList.end"
                        @click="goRefundType(1,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,ordersList.id)">
                        申请售后</view>

                      <view class="btn-item u-text-center u-FF0000 br-FF0000" v-if="ordersList.shipment_mode==0"
                        @click="changeAddress(ordersList.id)">修改地址</view>
                    </view>
                    <!--等待使用-->
                    <view class="u-flex-center" style="justify-content: flex-end;"
                      v-if="ordersList.transaction_status==3">
                      <view class="btn-item u-text-center u-999 br-999" v-if="ordersList.shipment_mode==0"
                        @click="lookLoginsList(ordersList.id,ordersList.goods_number,ordersList.child_order_list[0].goods_img,1)">
                        查看物流</view>
                      <view class="btn-item u-text-center u-FF0000 br-FF0000" v-if="ordersList.shipment_mode==0"
                        @click="sureGetOrder(ordersList.id,1)">确认收货</view>
                    </view>

                    <!--待评价-->
                    <view v-if="ordersList.transaction_status==5&&ordersList.comment_status==0&&!ordersList.end"
                      @click="goRefundType(2,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,item.id,ordersList.id)"
                      class="btn-item u-text-center u-999 br-999">申请售后</view>
                    <view class="u-flex-center" style="justify-content: flex-end;"
                      v-if="ordersList.transaction_status==5&&!ordersList.end">


                    </view>
                    <view class="btn-item u-text-center u-999 br-999" @click="goOrderDetails(ordersList.id)">查看详情</view>

                  </view>
                </view>

              </view>
            </view>
          </view>
          <view class="listone childBox" v-else>
            <view class="u-plr30 u-border-one h90">
              <view class="u-flex-center-sb">
                <view>
                  <text class="iconfont2 u-font34 u-bold " style="color: #057D53;">&#xe611;</text>
                  <text class="u-1A1A1A u-font30 u-ml15">惠选中亿平台</text>
                  <text class="u-CCC right-icon iconfont">&#xe6c7;</text>
                </view>
                <text class="u-FF0000 u-font28" v-if="item.close_mode==0">待付款</text>
                <text class="u-FF0000 u-font28" v-if="item.close_mode==1">已关闭</text>
                <text class="u-FF0000 u-font28" v-if="item.close_mode==2">商家关闭</text>
                <text class="u-FF0000 u-font28" v-if="item.close_mode==3">支付过期</text>
              </view>
            </view>
            <view class="u-border-one-one"></view>
            <view class="listImg u-border-one" @click="goOrderDetailsPay(item.id)">
              <image class="listimgGroup" :src="url" mode="" v-for="(url,index) in item.goods_images" :key="index">
              </image>
            </view>
            <view class="u-mt20 u-text-right u-plr30">
              <view class="u-flex-center" style="justify-content: flex-end;"> <text>总金额</text>
                <view class="u-FF0000 u-font32">
                  <rich-text :nodes="$mUtil.priceBigSmall(item.total_amount)"></rich-text>
                </view>
              </view>
              <!-- <view class="u-mt10">含运费￥10.00</view> -->
              <view class="u-flex-column-end u-mt30">
                <view class="btn-type u-flex">
                  <!--待付款-->
                  <view class="u-flex-center" style="justify-content: flex-end;" v-if="item.close_mode==0">
                    <!-- <view class="pay-time"> <text class="iconfont">&#xe681;</text> 支付剩余11（{{$mUtil.patTime(item.expired_pay_time)}})</view> -->
                    <view class="pay-time"> <text class="iconfont time-icon">&#xe681;</text> 支付剩余
                      ({{item | dateFilter}})</view>
                    <view class="btn-item u-text-center u-FF0000 br-FF0000"
                      @click="waitpayOrder(item.id,item.total_amount,item.expired_pay_time)">去付款</view>
                  </view>
                  <view v-if="item.close_mode==1" class="btn-item u-text-center u-999 br-999"
                    @click="goOrderDetailsPay(item.id)">查看详情</view>


                </view>
              </view>

            </view>
          </view>

        </view>
        <nodata v-if="noData" :config="{top:20,content:'暂无数据~'}"></nodata>
        <loadMore v-if="orderList.length>0" :status="status"></loadMore>
      </view>


      <!-- 待使用，待使用，待评价 -->
      <view class="order-list" v-if="isChange==2||isChange==3">
        <view class="order-item u-font24 u-1A1A1A" v-for="(ordersList,index) in orderListOther" :key="ordersList.id">
          <view class="listtwo">
            <view class="childBox">
              <view class="u-plr30 pt15-pb24">
                <view class="u-flex-center-sb">
                  <view class="u-text1 viewWidthTitle">
                    <text class="iconfont2 u-font34 u-bold " style="color: #057D53;">&#xe611;</text>
                    <text class="u-1A1A1A u-font30 u-ml15">{{ordersList.shop_name}}</text>
                  </view>
                  <view v-if="ordersList.end==true">
                    <text class="u-FF0000 u-font28">交易完成</text>
                  </view>
                  <view v-if="ordersList.end==false">
                    <text class="u-FF0000 u-font28" v-if="ordersList.comment_status==2">交易完成</text>
                    <text class="u-FF0000 u-font28"
                      v-if="(ordersList.comment_status==0||ordersList.comment_status==1)&&ordersList.rights_type==0">{{ordersList.transaction_status | payStatus}}</text>
                    <text class="u-FF0000 u-font28" v-if="ordersList.rights_type >0">维权中</text>
                  </view>
                </view>
              </view>
              <view class="u-border-one-one"></view>
              <view v-for="childItem in ordersList.child_order_list" :key="childItem.id"
                @click="goProductDetails(childItem.goods_id,childItem.source_shop_id)">
                <ldgoods :value="childItem" :position="list"></ldgoods>
              </view>
              <view class="u-mt20 u-text-right u-plr30">
                <view class="u-flex-center" style="justify-content: flex-end;">
                  <text>共{{ordersList.goods_number}}件商品，总金额</text>
                  <view class="u-FF0000 u-font32">
                    <rich-text :nodes="$mUtil.priceBigSmall(ordersList.total_amount)"></rich-text>
                  </view>
                </view>
                <view class="u-mt10" v-if="ordersList.should_freight*1 > 0">含运费￥{{ordersList.should_freight}}</view>
                <view class="u-flex-column-end u-mt30">
                  <view class="btn-type u-flex">
                    <!--等待使用-->
                    <view class="u-flex-center" style="justify-content: flex-end;"
                      v-if="ordersList.transaction_status==1&&ordersList.rights_type==0">
                      <view class="btn-item u-text-center u-999 br-999" v-if="!ordersList.end"
                        @click="goRefundType(1,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,ordersList.id)">
                        申请售后</view>
                      <!-- <view class="btn-item u-text-center u-999 br-999"  @click="goPhone(ordersList.mobile)">联系客服</view> -->
                      <view class="btn-item u-text-center u-FF0000 br-FF0000" v-if="ordersList.shipment_mode==0"
                        @click="changeAddress(ordersList.id)">修改地址</view>
                    </view>
                    <!--等待使用-->
                    <view class="u-flex-center" style="justify-content: flex-end;"
                      v-if="ordersList.transaction_status==3&&ordersList.shipment_mode==0">
                      <!-- <view class="btn-item u-text-center u-999 br-999">申请退货</view> -->
                      <view class="btn-item u-text-center u-999 br-999"
                        @click="lookLoginsList(ordersList.id,ordersList.goods_number,ordersList.child_order_list[0].goods_img,1)">
                        查看物流</view>
                      <view class="btn-item u-text-center u-FF0000 br-FF0000" v-if="ordersList.shipment_mode==0"
                        @click="sureGetOrder(ordersList.id,2)">确认收货</view>
                    </view>

                    <!--待评价-->
                    <view v-if="ordersList.transaction_status==5&&!ordersList.end"
                      class="btn-item u-text-center u-999 br-999"
                      @click="goRefundType(2,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,orderListOther.id,ordersList.id)">
                      申请售后</view>
                    <!--待提货-->

                    <!-- <view v-if="ordersList.transaction_status==3 &&ordersList.shipment_mode==1" class="btn-item u-text-center u-999 br-999">确认提货</view> -->
                    <!--申请退款中-->
                    <view class="btn-item u-text-center u-999 br-999" @click="goOrderDetails(ordersList.id)">查看详情</view>
                    <view class="btn-item u-text-center u-999 br-999"
                      v-if="ordersList.use_status==0&&ordersList.rights_type == 0 && ordersList.rights_status == 0"
                      @click="goRefundType(1,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,ordersList.id)">
                      申请售后</view>

                  </view>
                </view>

              </view>
            </view>
          </view>

        </view>
        <nodata v-if="noData" :config="{top:20,content:'暂无数据~'}"></nodata>
        <loadMore v-if="orderListOther.length>0" :status="status"></loadMore>
      </view>
      <!-- 退款退货 -->
      <view class="order-list" v-if="isChange==4">
        <view class="order-item u-font24 u-1A1A1A" v-for="(ordersList) in orderListblack" :key="ordersList.id">
          <view class="listtwo">
            <view class="childBox">
              <view class="u-plr30 pt15-pb24 u-border-one">
                <view class="u-flex-center-sb">
                  <view class="u-text1 viewWidthTitle">
                    <text class="iconfont2 u-font34 u-bold " style="color: #057D53;">&#xe611;</text>
                    <text class="u-1A1A1A   u-font30 u-ml15">{{ordersList.shop_name}}</text>
                  </view>
                  <text class="u-FF0000 u-font28"
                    v-if="ordersList.rights_type==1">{{ordersList.rights_operate_status | payStatusRight}}</text>
                  <text class="u-FF0000 u-font28"
                    v-if="ordersList.rights_type==2">{{ordersList.rights_operate_status | payStatusRights}}</text>
                </view>
              </view>
              <view class="u-border-one-one"></view>
              <view v-for="childItem in ordersList.rights_child_orders" :key="childItem.id"
                @click="goProductDetails(childItem.goods_id,childItem.shop_id)">
                <ldgoodsbalck :value="childItem" :position="list"></ldgoodsbalck>
              </view>
              <view class="u-mt20 u-text-right u-plr30">
                <view class="u-flex-center" style="justify-content: flex-end;">
                  <text>共{{ordersList.refund_num}}件商品，退款金额</text>
                  <view class="u-FF0000 u-font32">
                    <rich-text :nodes="$mUtil.priceBigSmall(ordersList.refund_money)"></rich-text>
                  </view>
                </view>
                <view class="u-flex-column-end u-mt30">
                  <view class="btn-type u-flex">
                    <view class="u-flex-center" style="justify-content: flex-end;">
                      <view class="btn-item u-text-center u-999 br-999"
                        @click="gotoBalckDetail(ordersList.id,ordersList.shop_id,ordersList.rights_type,ordersList.rights_operate_status)">
                        查看详情</view>

                      <view class="btn-item u-text-center u-999 br-999"
                        @click="lookLoginsList(ordersList.id,ordersList.refund_num,ordersList.rights_child_orders[0].goods_img,2)"
                        v-if="ordersList.rights_type==2&&ordersList.rights_operate_status==2">查看物流</view>
                      <view class="btn-item u-text-center u-FF0000 br-FF0000"
                        @click="gotoBalckDetail(ordersList.id,ordersList.shop_id,ordersList.rights_type,ordersList.rights_operate_status)"
                        v-if="ordersList.rights_type==2&&ordersList.rights_operate_status==1">去发货</view>
                    </view>
                  </view>
                </view>

              </view>
            </view>
          </view>

        </view>
        <nodata v-if="noData" :config="{top:20,content:'暂无数据~'}"></nodata>
        <loadMore v-if="orderListblack.length>0" :status="status"></loadMore>
      </view>
    </view>
    <!--页面加载动画-->
    <ldLoading isFullScreen :active="loading"></ldLoading>
  </view>
</template>

<script>
  import ldgoodsbalck from "../../../components/ld-goods/ld-goods-black.vue"
  import ldgoods from "../../../components/ld-goods/ld-goods.vue"
  var app = getApp()
  let vObj
  export default {
    components: {
      ldgoodsbalck,
      ldgoods
    },
    beforeCreate() {
      vObj = this
    },
    data() {
      return {
        timer: null,
        timeCount: 0,
        list: 1,
        config: {
          back: true, //false是tolbar页面 是则不写
          title: '全部订单',
          color: '#1A1A1A',
          //背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
          backgroundColor: [1, "#FFFFFF"],
          statusBarFontColor: '#1A1A1A',
          backPage: '/pages/index/personal'
          // backTabPage: '/pages/index/personal'

        },
        isChange: 0,
        orderType: ["全部订单", "待付款", "待使用", "待评价", "退款"],
        shopStatus: true, //发货状态
        loading: true,
        orderList: [], //全部订单，待支付
        orderListOther: [], //待使用,待使用,待评价
        orderListblack: [],
        status: 'more', //more|loading|noMore
        noData: false,
        parmas: {
          page: 1,
          limit: 10,
          order_type: 2
        },
        parmasother: {
          page: 1,
          limit: 10,
          order_type: 2
        },
        parmasblack: {
          page: 1,
          limit: 10,
          order_type: 2
        },
        orderid: null,
        currentKey: null,
        tabTop: 0
      }
    },
    beforeDestroy() {
      clearInterval(this.timer)
    },
    onBackPress() {
      uni.redirectTo({
        url: "../../index/personal"
      })
      return true
    },
    onReachBottom(e) {
      this.status = 'loading'
      if (this.isChange == 0) {
        this.parmas.page++
        this.getOrderList()
      } else if (this.isChange == 1) {
        this.parmas.page++
        this.waitPay()
      } else if (this.isChange == 4) {
        this.parmasblack.page++
        this.blackPay()
      } else {
        this.parmasother.page++
        let key = 1
        if (this.isChange == 2) {
          key = 3
        } else if (this.isChange == 3) {
          key = 5
        }
        this.otherPay(key)
      }

    },
    onPullDownRefresh() {
      this.rest()
      if (this.isChange == 0) {
        this.getOrderList()
      } else if (this.isChange == 1) {
        this.waitPay()
      } else if (this.isChange == 4) {
        this.blackPay()
      } else {
        let key = 1
        if (this.isChange == 2) {
          key = 3
        } else if (this.isChange == 3) {
          key = 5
        }
        this.otherPay(key)
      }

    },
    onLoad(options) {
      let that = this
      this.timer = setInterval(() => {
        that.timeCount++
      }, 1000)

      this.tabTop = app.globalData.barHeight + 44;
      if (options.keys) {
        if (options.keys == -1) {
          this.isChange = 0
          this.getOrderList()
        } else if (options.keys == 0) {
          this.isChange = 1
          this.waitPay()
        } else if (options.keys == 6) {
          this.isChange = 4
          this.blackPay()
        } else {
          if (options.keys == 3) {
            this.isChange = 2
          } else if (options.keys == 5) {
            this.isChange = 3
          }
          this.currentKey = options.keys
          this.otherPay(options.keys)
        }
      } else {
        this.getOrderList()
      }


    },
    filters: {
      dateFilter(item) {
        // console.log(item,'item')
        // item.expired_pay_time
        // endTime - nowTime

        let time = item.expired_pay_time - item.now_millis - vObj.timeCount * 1000;
        console.log(time)

        let str = vObj.$mUtil.countDownClock(time)

        return str
      },
      payStatus(val) {
        switch (val) {
          case 0:
            return "待支付"
            break;
          case 1:
            return "待使用"
            break;
          case 2:
            return "部分发货"
            break;
          case 3:
            return "待使用"
            break;
          case 4:
            return "部分已使用"
            break;
          case 5:
            return "待评价"
            break;
          case 6:
            return "关闭"
            break;
          default:
            break;
        }
      },
      payStatusRight(val) { //退款
        //维权订单操作状态（0申请，1同意，2买家已发货，3商家已收到退货商品,4商家发起退款支付，5已支付退款,6拒绝，7自动关闭,8主动撤消
        switch (val) {
          case 0:
            return "申请退款中"
            break;
          case 1:
            return "商家同意"
            break;
          case 4:
            return "商家发起退款支付"
            break;
          case 5:
            return "退款成功"
            break;
          case 6:
            return "商家拒绝"
            break;
          default:
            break;
        }
      },
      payStatusRights(val) { //退款退货
        //维权订单操作状态（0申请，1同意，2买家已发货，3商家已收到退货商品,4商家发起退款支付，5已支付退款,6拒绝，7自动关闭,8主动撤消
        switch (val) {
          case 0:
            return "申请退款/退货中"
            break;
          case 1:
            return "等待买家发货"
            break;
          case 2:
            return "待商家收货"
            break;
          case 3:
            return "商家已收货"
            break;
          case 4:
            return "商家待打款"
            break;
          case 5:
            return "退款/退货成功"
            break;
          case 6:
            return "商家拒绝"
            break;
          case 7:
            return "自动关闭"
            break;
          case 8:
            return "撤销"
            break;
          default:
            break;
        }
      }
    },
    methods: {
      goProductDetails(id, shopid) {
        uni.navigateTo({
          url: "/pages/product/goods/serviceGood?id=" + id + "&shopid=" + shopid
        })
      },
      goPhone(phone) {
        if (phone) {
          uni.makePhoneCall({
            phoneNumber: phone //仅为示例
          });
        }
      },
      // 物流//type：1普通订单，2维权订单
      lookLoginsList(orderid, num, img, type) {
        uni.navigateTo({
          url: "../logistics?id=" + orderid + "&num=" + num + "&img=" + img + "&type=" + type,
        })
      },
      //申请售后
      goRefundType(i, code, time, list, orderid, childid) {
        //i:1未发货，退款，2收到货退款/退货
        uni.setStorageSync('blackgoodsList', list)
        if (i == 1) {
          uni.navigateTo({
            url: "applicationDrawback?keystatus=" + i + "&title=申请退款" + "&orderid=" + orderid + "&type=service"
          })
        } else {
          uni.navigateTo({
            url: "refundType?order_code=" + code + '&format_order_time=' + time + '&keystatus=' + i + "&orderid=" +
              orderid + "&childid=" + childid
          })
        }

      },
      //确认收货
      sureGetOrder(id, k) {
        uni.showModal({
          title: '提示',
          content: '确定已经收到了该商品？',
          success: (res) => {
            if (res.confirm) {
              this.$http.post('/order/receipt', {
                  order_id: id
                })
                .then(res => {
                  if (res && res.code == 200) {
                    this.$mUtil.toast('收货成功')
                    this.rest()
                    if (k == 1) {
                      this.getOrderList()
                    } else if (k == 2) {
                      this.otherPay(this.currentKey)
                    }

                  }
                })
            } else if (res.cancel) {

            }
          }
        });
      },
      //选完地址回选
      otherFun(object) {
        if (!!object) {
          console.log(object.addressid)
          this.$http.put('/order/update-receipt/' + this.orderid + '/' + object.addressid)
            .then(res => {
              if (res && res.code == 200) {
                this.$mUtil.toast('修改成功')
              }
            })
        }
      },
      //修改地址
      changeAddress(id) {
        this.orderid = id
        uni.navigateTo({
          url: '/pages/user/address/addressList'
        })
      },
      rest() {
        this.parmas.page = 1
        this.parmasother.page = 1
        this.parmasblack.page = 1
        this.orderList = []
        this.orderListOther = []
        this.orderListblack = []
      },
      getOrderList() {
        this.$http.get('/pay/order/all/page', this.parmas)
          .then(res => {
            this.loading = false;
            if (res && res.code == 200) {
              uni.stopPullDownRefresh()
              this.orderList = this.orderList.concat(res.page.list)
              if (this.orderList.length == 0) {
                this.noData = true
              } else {
                this.noData = false
              }
              if (res.page.totalPage <= res.page.currPage) {
                this.status = 'noMore'
              } else {
                this.status = 'more'
              }
            }
          })
      },
      waitPay() {
        this.$http.get('/pay/order/wait/page', this.parmas)
          .then(res => {
            this.loading = false;
            if (res && res.code == 200) {
              uni.stopPullDownRefresh()
              this.orderList = this.orderList.concat(res.page.list)
              if (this.orderList.length == 0) {
                this.noData = true
              } else {
                this.noData = false
              }
              if (res.page.totalPage <= res.page.currPage) {
                this.status = 'noMore'
              } else {
                this.status = 'more'
              }
            }
          })
      },
      otherPay(k) {
        this.parmasother.transaction_status = k //0已下单,待支付，1待使用（待备货） 3,"待使用（待自提）",5交易完成
        this.$http.get('/order/page', this.parmasother)
          .then(res => {
            this.loading = false;
            if (res && res.code == 200) {
              uni.stopPullDownRefresh()
              this.orderListOther = this.orderListOther.concat(res.page.list)
              if (this.orderListOther.length == 0) {
                this.noData = true
              } else {
                this.noData = false
              }
              if (res.page.totalPage <= res.page.currPage) {
                this.status = 'noMore'
              } else {
                this.status = 'more'
              }
            }
          })
      },
      blackPay() {
        this.$http.get('/rights/page', this.parmasblack)
          .then(res => {
            this.loading = false;
            if (res && res.code == 200) {
              uni.stopPullDownRefresh()
              this.orderListblack = this.orderListblack.concat(res.page.list)

              if (this.orderListblack.length == 0) {
                this.noData = true
              } else {
                this.noData = false
              }
              if (res.page.totalPage <= res.page.currPage) {
                this.status = 'noMore'
              } else {
                this.status = 'more'
              }
            }
          })
      },
      clickBtn(index) {
        this.rest()
        this.isChange = index
        if (index == 0) {
          this.getOrderList()
        } else if (index == 1) {
          this.waitPay()
        } else if (index == 2 || index == 3) {
          let key = 1
          if (index == 2) {
            key = 3
          } else if (index == 3) {
            key = 5
          }
          this.currentKey = key
          this.otherPay(key)
        } else { //退货/退款
          this.blackPay()
        }
      },
      //支付
      waitpayOrder(id, total_amount, expired_pay_time) {
        uni.navigateTo({
          url: '../../order/pay?id=' + id + '&total_amount=' + total_amount + '&expired_pay_time=' +
            expired_pay_time + '&type=service'
        })
      },
      //详情页
      goOrderDetails(id) {
        uni.navigateTo({
          url: "serviceOrderDetail?id=" + id + '&status=pay'
        })
      },
      gotoBalckDetail(id, shopid, type, status) {
        uni.navigateTo({
          url: "orderblackDetails?id=" + id + "&shopid=" + shopid + "&type=" + type + "&status=" + status
        })
      },

      //支付订单
      goOrderDetailsPay(id) {
        uni.navigateTo({
          url: "serviceOrderDetail?id=" + id + '&status=waitpay'
        })
      },
    }
  }
</script>

<style lang="scss">
  page {
    background-color: #F5F5F5;
  }

  .right-icon {
    font-size: 25rpx
  }

  .plrbottom {
    padding: 110rpx 30rpx 0;
  }

  .h90 {
    height: 90rpx;
    line-height: 90rpx;
  }

  .topview {
    background-color: #F5F5F5;
    height: 110rpx;
    width: 100%;
    position: fixed;
    left: 0;
    box-sizing: border-box;
    padding: 0 30rpx;
    z-index: 66;
  }

  .scrollbox {
    white-space: nowrap;
  }

  .pt-pb {
    padding: 30rpx;
  }

  .pt15-pb24 {
    padding-top: 24rpx;
    padding-bottom: 24rpx;
  }

  .br-FF0000 {
    border: 1px solid #FF0000;
  }

  .br-999 {
    border: 1px solid #999999;
  }

  .order-type {
    margin-top: 30rpx;
    margin-bottom: 26rpx;
    display: inline-block;

    .active {
      background: #0B844A;
      color: #FFFFFF;
    }

    .type-name {
      border-radius: 30px;
      padding: 12rpx 18rpx;
      display: inline-block;
    }
  }

  .listImg {
    padding: 20rpx 0 0 16rpx;
  }

  .listimgGroup {
    width: 200rpx;
    height: 200rpx;
    margin: 0 25rpx 25rpx 0;
    border-radius: 15rpx;
  }

  .order-item {

    .btn-type {
      padding-bottom: 25rpx;

      .pay-time {
        line-height: 70rpx;
        margin-left: auto;

        .time-icon {
          color: #999999;
        }
      }

      .btn-item {
        width: 200rpx;
        height: 70rpx;
        line-height: 68rpx;
        border-radius: 35px;
        margin-left: 22rpx;
      }
    }
  }

  .childBox {
    background-color: #FFFFFF;
    border-radius: 20rpx;
    margin-bottom: 30rpx;
  }
</style>
